import { reqCategoryList, reqGetBannerList, reqFloorList} from "@/api";
const state = {
    categroyList: [],
    bannerList: [],
    floorList:[]
};
const mutations = {
    CATEGROYLIST(state, value) {
        state.categroyList = value
        // console.log(state.categroyList);
    },
    GETBANNERLIST(state, value) {
        state.bannerList = value
    },
    GETFLOORLIST(state, value) {
        state.floorList = value
    },
};
const actions = {
    //向服务器发请求，获取数据
    async categroyList(context) {
        let result = await reqCategoryList();
        if (result.code === 200) {
            context.commit('CATEGROYLIST', result.data);
        }

    },
    async getBannerList(context) {
        let result = await reqGetBannerList();
        if (result.code === 200) {
            context.commit('GETBANNERLIST', result.data);
        }
    },
    async getFloorList(context) {
        let result = await reqFloorList();
        if (result.code === 200) {
            context.commit('GETFLOORLIST', result.data);
        }
    }
};


const getters = {};

export default {
    namespaced: true,
    state,
    actions,
    mutations,
    getters
}